public methods for hal_cc2530znp_target_board.c More...
#include "msp430x22x4.h"#include "../Common/printf.h"#include "../Common/utilities.h"Defines | |
| #define | HAL_SLEEP() ( __bis_SR_register(LPM3_bits + GIE)) |
| #define | HAL_WAKEUP() ( __bic_SR_register_on_exit(LPM3_bits)) |
| #define | ENABLE_SRDY_INTERRUPT() (P2IE |= BIT6) |
| #define | DISABLE_SRDY_INTERRUPT() (P2IE &= ~BIT6) |
| #define | HAL_ENABLE_INTERRUPTS() (_EINT()) |
| #define | HAL_DISABLE_INTERRUPTS() (_DINT()) |
| #define | SRDY_INTERRUPT_FALLING_EDGE 0x01 |
| #define | SRDY_INTERRUPT_RISING_EDGE 0x00 |
| #define | RADIO_ON() (P3OUT |= BIT7) |
| #define | RADIO_OFF() (P3OUT &= ~BIT7) |
| #define | SPI_SS_SET() (P3OUT &= ~(BIT0 | BIT6)) |
| #define | SPI_SS_CLEAR() (P3OUT |= (BIT0 | BIT6)) |
| #define | SRDY_IS_HIGH() (P2IN & BIT6) |
| #define | SRDY_IS_LOW() ((~P2IN) & BIT6) |
| #define | DEBUG_ON() (P4OUT |= BIT4) |
| #define | DEBUG_OFF() (P4OUT &= BIT4) |
| #define | NO_WAKEUP 0 |
| #define | WAKEUP_AFTER_TIMER 1 |
| #define | WAKEUP_AFTER_ACCELEROMETER 2 |
| #define | WAKEUP_AFTER_SRDY 4 |
| #define | XTAL 8000000L |
| #define | TICKS_PER_MS (XTAL / 1000 / 5 - 1) |
| #define | TICKS_PER_US (TICKS_PER_MS / 1000) |
| #define | VLO_NOMINAL 12000 |
| #define | VLO_MIN (VLO_NOMINAL - (VLO_NOMINAL/4)) |
| #define | VLO_MAX (VLO_NOMINAL + (VLO_NOMINAL/4)) |
| #define | GET_MCLK_FREQ() 8000000L |
| #define | LIGHT_SENSOR_ON() (P2OUT |= BIT1) |
| #define | LIGHT_SENSOR_OFF() (P2OUT &= ~BIT1) |
| #define | ACCELEROMETER_SS_SET() (P2OUT &= ~(BIT2|BIT7)) |
| #define | ACCELEROMETER_SS_CLEAR() (P2OUT |= (BIT2|BIT7)) |
| #define | ACCELEROMETER_RX_BUF UCB0RXBUF |
Functions | |
| void | halInit () |
| void | delayMs (unsigned int ms) |
| void | delayUs (unsigned int us) |
| signed int | toggleLed (unsigned char led) |
| signed int | setLed (unsigned char led) |
| void | clearLeds () |
| void | halSpiInitZnp () |
| void | spiWrite (unsigned char *bytes, unsigned char numBytes) |
| signed int | calibrateVlo () |
| signed int | initTimer (unsigned char seconds, unsigned char wakeOnTimer) |
| unsigned int | getVcc3 () |
| unsigned int | getLightSensor () |
| void | setZnpInterfaceToInputs (void) |
| signed int | halConfigureSrdyInterrrupt (unsigned char flags) |
| void | halSpiInitAccelerometer () |
| signed int | halEnableAccelerometerInterrupt (unsigned char wakeOnAccelerometer) |
| unsigned char | spiWriteAccelerometer (unsigned char b) |
public methods for hal_cc2530znp_target_board.c
YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
| signed int calibrateVlo | ( | ) |
Calibrate VLO. Once this is done, the VLO can be used semi-accurately for timers etc. Once calibrated, VLO is within ~2% of actual when using a 1% calibrated DCO frequency and temperature and supply voltage remain unchanged.
Calibrate VLO. Once this is done, the VLO can be used semi-accurately for timers etc. Once calibrated, VLO is within ~2% of actual when using a 1% calibrated DCO frequency and temperature and supply voltage remain unchanged. At room temperature, typical VLO frequencies seen are 9kHz (MSP430F248) and 12kHz (MSP430F2274)
| void clearLeds | ( | ) |
Turns OFF LEDs.
Turn off all LEDs
Turns OFF the specified LED. Required for ZNP examples.
| led | the LED to turn off, must be 0,1,2,3,4. |
| void delayMs | ( | unsigned int | ms | ) |
Blocking Delay in Milliseconds delays by at least the specified number of milliseconds (ms)
| ms | number of milliseconds to delay |
| void delayUs | ( | unsigned int | us | ) |
Blocking Delay in Microseconds delays by at least the specified number of microseconds (us)
| us | number of microseconds to delay |
| unsigned int getLightSensor | ( | ) |
Reads the light sensor. Turns on Light sensor, configures ADC, reads the value, and converts it to lux.
| unsigned int getVcc3 | ( | ) |
Reads the MSP430 supply voltage using the Analog to Digital Converter (ADC). On CC2530ZNP target board, this is approx. 3600mV
Measures Vcc to the MSP430, nominally 3300mV
| signed int halConfigureSrdyInterrrupt | ( | unsigned char | flags | ) |
Configures SRDY interrupt. Does NOT enable the interrupt. On the CC2530 target board, SRDY is P2.6
| flags | the options for the SRDY interrupt:
|
| signed int halEnableAccelerometerInterrupt | ( | unsigned char | wakeOnAccelerometer | ) |
Enables the interrupt on the accelerometer (P1.3).
| wakeOnAccelerometer | whether to wakeup after this int is triggered. Must be either NO_WAKEUP or WAKEUP_AFTER_ACCELEROMETER. |
| void halInit | ( | ) |
Configures hardware for the particular hardware platform:
Configures hardware for the ZNP peripherals
Configures hardware for the particular board
| void halSpiInitAccelerometer | ( | ) |
Initializes the SPI port for the Accelerometer. Required because accelerometer SPI port uses different settings than the ZNP SPI port
| void halSpiInitZnp | ( | ) |
Initializes the Serial Peripheral Interface (SPI) interface to the Zigbee Network Processor (ZNP).
Configures the SPI port for ZNP operation
Initializes the SPI interface to the ZNP.
| signed int initTimer | ( | unsigned char | seconds, | |
| unsigned char | wakeOnTimer | |||
| ) |
Configures timer.
| seconds | period of the timer. Maximum is 0xFFFF / vloFrequency; or about 4 since VLO varies between 9kHz - 15kHz. Use a prescaler on timer (e.g. set IDx bits in TACTL register) for longer times. Maximum prescaling of Timer A is divide by 8. Even longer times can be obtained by prescaling ACLK if this doesn't affect other system peripherals. | |
| wakeOnTimer | whether to wake the processor after the timer interrupt. Must be either NO_WAKEUP or WAKEUP_AFTER_TIMER. |
Configures timer for source = ACLK
| seconds | period of the timer. Maximum is 0xFFFF / aClk; about 2 if using 32kHz xtal or about 4 if using VLO since VLO varies between 9kHz - 15kHz. Use a prescaler on timer (e.g. set IDx bits in TACTL register) for longer times. Maximum prescaling of Timer A is divide by 8. Even longer times can be obtained by prescaling ACLK if this doesn't affect other system peripherals. |
| signed int setLed | ( | unsigned char | led | ) |
Turns ON the specified LED.
| led | the LED to turn on, must be 0 or 1. |
Turn on the specified LED
Turns ON the specified LED. Required for ZNP examples.
| led | the LED to turn on, must be 0,1,2,3,4. |
| void setZnpInterfaceToInputs | ( | void | ) |
Configures all ZNP interface signals as inputs to allow the ZNP to be programmed. Toggles LED0 quickly to indicate application is running.
| void spiWrite | ( | unsigned char * | bytes, | |
| unsigned char | numBytes | |||
| ) |
Sends a message over SPI to the ZNP. Based on hal_board.c in CC2480 example application ZASA. The ZNP uses a "write-to-read" approach: to read data out, you must write data in. This is a private method that gets wrapped by other methods, e.g. spiSreq(), spiAreq, etc. To Write, set *bytes and numBytes. To Read, set *bytes only. Don't need to set numBytes because CC2530ZNP will stop when no more bytes are received.
| bytes | the data to be sent or received. | |
| numBytes | the number of bytes to be sent. This same buffer will be overwritten with the received data. |
Sends a message over SPI to the radio IC on USCI_B1. Based on hal_board.c in CC2480 example application ZASA. SPI uses a "write-to-read" approach to read data out, you must write data in. This is a private method that gets wrapped by other methods, e.g. spiSreq(), spiPoll(), etc. To Write, set *bytes, numBytes. To Read, set *bytes only. Don't need to set numBytes because CC2530ZNP will stop when no more bytes read.
| bytes | the data to be sent or received. | |
| numBytes | the number of bytes to be sent. This same buffer will be overwritten with the received data. |
Sends a message over SPI to the radio IC on USCI_B1. Based on hal_board.c in CC2480 example application ZASA. The ZNP uses a "write-to-read" approach to read data out, you must write data in. This is a private method that gets wrapped by other methods, e.g. spiSreq(), spiAreq, etc. To Write, set *bytes, numBytes. To Read, set *bytes only. Don't need to set numBytes because CC2530ZNP will stop when no more bytes read.
| bytes | the data to be sent or received. | |
| numBytes | the number of bytes to be sent. This same buffer will be overwritten with the received data. |
| signed int toggleLed | ( | unsigned char | whichLed | ) |
Toggles the specified LED.
| led | the LED to toggle, must be 0 or 1. |
Toggles the specified button LED.
| whichLed | the LED to toggle, must be 0-4. |
1.6.3